package com.atguigu.practice;

import java.util.Scanner;

public class TheLengthOfTheCommonString {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s1=scanner.next();
        String s2=scanner.next();
        if(s1.contains(s2)){
            System.out.println(s2.length());
            return;
        }else if(s2.contains(s1)){
            System.out.println(s1.length());
            return;
        }
        String Lstring=null;
        String Sstring=null;
        if(s1.length()>s2.length()){
            Lstring=s1;
            Sstring=s2;
        }else{
            Lstring=s2;
            Sstring=s1;
        }
        int max=0;
        for(int i=0;i<Lstring.length();i++){
            for(int j=0;j<Sstring.length();j++){
                int tmp=0;
                int m=i;
                int n=j;
                while(m<Lstring.length()&&n<Sstring.length()&&Lstring.charAt(m)==Sstring.charAt(n)){
                    tmp++;
                    m++;
                    n++;
                }
                if(tmp>max){
                    max=tmp;
                }
            }
        }
        System.out.println(max);
    }
}
